package cn.zhaozhiqi.controller.app;

import cn.zhaozhiqi.pojo.domain.Systemdictionary;
import cn.zhaozhiqi.pojo.query.PageQueryWrapper;
import cn.zhaozhiqi.result.JSONResult;
import cn.zhaozhiqi.result.PageResult;
import cn.zhaozhiqi.service.ISystemdictionaryService;
import cn.zhaozhiqi.template.OssTemplate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;

@Tag(name = "app上传下载接口",description = "app上传下载接口")
@RestController
@RequestMapping("/app")
public class AppController {

    @Autowired
    private OssTemplate ossTemplate;

    @Operation( summary= "上传文件到oss",description = "上传文件oss接口")
    @Parameter(name = "MultipartFile",description = "准备上传的文件对象",required = true)
    @PostMapping("/upload")
    public JSONResult upload(@RequestParam("file")MultipartFile file) throws IOException {
        return JSONResult.success(ossTemplate.upload(file));
    }



}
